package gold.digger;

import java.util.*;
import java.util.List;

/**
 * Created by fanzhenyu02 on 2020/6/27.
 * common problem solver template.
 */
public class LC137 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public int singleNumber(int[] nums) {
            Set<Long> set = new HashSet<>();
            long sumSet = 0, sumArray = 0;
            for (int num : nums) {
                sumArray += num;
                set.add(((long) num));
            }

            for (Long nu : set) {
                sumSet += nu;
            }

            return ((int) ((3 * sumSet - sumArray) / 2));
        }
    }

    public void run() {
        Solution solution = new Solution();
        List<Integer> list = new ArrayList<>();
        System.out.println(solution.toString());
    }

    public static void main(String[] args) throws Exception {
        LC137 an = new LC137();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
